refactor: ESM migration#523
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (44)
🚧 Files skipped from review as they are similar to previous changes (37)
📝 WalkthroughWalkthroughThe package migrates to ESM with explicit CommonJS compatibility, shared parser and recurring-event modules, generated build artifacts, updated timezone tooling, converted examples and tests, and revised package documentation. ChangesESM package and calendar processing
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant node_ical_js
participant createCoreApi
participant ical_js
participant expandRecurringEvent
Caller->>node_ical_js: import or require package
node_ical_js->>createCoreApi: construct sync and async APIs
Caller->>ical_js: parseICS input
ical_js-->>Caller: parsed calendar
Caller->>expandRecurringEvent: expand event range
expandRecurringEvent-->>Caller: sorted instances
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 8
🧹 Nitpick comments (2)
test/module-formats.test.js (1)
49-76: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDuplicated key-parity check across two tests.
The key-parity loop at Lines 61–63 (
for (const key of Object.keys(esm.default)) { assert.ok(Object.hasOwn(cjs, key), ...) }) is repeated verbatim at Lines 73–75 in the next test. Consider consolidating into a shared helper or merging the assertions into a single test to avoid drift.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/module-formats.test.js` around lines 49 - 76, Consolidate the duplicated ESM/CJS key-parity loop currently present in both tests. Either merge the assertions into one test or extract a shared helper and reuse it from the tests, while preserving the existing missing-key assertion message and API checks.node-ical.d.ts (1)
112-125: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider more precise types for internal properties currently typed
unknown.
objectHandlers,handleObject, andparseLinesare typed asunknown, which gives consumers no type safety if they access these properties. If this is intentional to discourage direct use, consider adding a brief comment explaining that. Otherwise, typing them (e.g., asRecord<string, (...args: unknown[]) => unknown>and(...args: unknown[]) => unknown) would improve the developer experience for advanced consumers.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@node-ical.d.ts` around lines 112 - 125, Improve the declarations for objectHandlers, handleObject, and parseLines in the default export object: either replace unknown with accurate callable/record types for these internal properties, or add a brief comment documenting that unknown is intentional to discourage direct consumer use. Preserve the existing exported API shape and type the properties consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@build/update-windows-zones.js`:
- Around line 18-45: Update fetchText to enforce a request timeout so stalled
CLDR requests reject instead of hanging CI. Prefer replacing the manual
https.get redirect flow with Node 20’s fetch and AbortSignal.timeout(), while
preserving non-success HTTP errors and returning the response text for
successful requests.
In `@ical.js`:
- Around line 463-475: Update the named exports for handleObject, parseLines,
and parseICS in ical.js to bind each function to the ical object so calls retain
the required this context; apply the same binding treatment to the equivalent
exports in node-ical.js, while leaving objectHandlers unchanged.
In `@lib/expand-recurring-event.js`:
- Around line 94-120: Update getEventDurationMs and calculateEndTime to
represent full-day durations as calendar-day counts rather than fixed
milliseconds. For full-day events, compute the span between local calendar dates
and advance the start using local date arithmetic so DST transitions preserve
the correct end date; keep timed-event millisecond duration behavior unchanged.
- Around line 345-358: Update the recurring-instance expansion around
buildRecurringInstance so it also inspects event.recurrences overrides whose
effective start falls within the requested range, even when their RECURRENCE-ID
is outside searchFrom..searchTo. Merge these override-derived instances with the
RRULE results, deduplicate instances already produced through RRULE expansion,
then retain the existing range filtering and start-time sorting.
In `@lib/ical-parser-utils.js`:
- Around line 41-46: Update copyRecordFields to iterate and copy only source own
properties using Object.hasOwn, and avoid assignment-based writes for the
__proto__ UID by defining UID-keyed properties with Object.defineProperty or
using null-prototype records throughout the related merge/recurrence path. Apply
the same protection to the code around the UID handling at the referenced later
section, preserving normal field-copy behavior for other keys.
- Around line 721-733: Update freebusyParameter so it invokes the FREEBUSY
storage handler returned or registered by storeParameter, rather than merely
calling storeParameter and discarding its result. Ensure the raw value and
parameters are persisted on fb before dateParameter processes the start and end
parts.
- Around line 185-194: Update applyImplicitEndDate for DATE entries to advance
entry.start by one calendar day while preserving local midnight, rather than
using utcAdd(..., 1, 'days'). Keep the existing date-time cloning behavior and
return flow unchanged.
In `@package.json`:
- Around line 4-24: Update the package.json engines.node constraint to require
Node.js >=20.10.0, ensuring the ESM entry using JSON import attributes is not
exposed to unsupported Node 20.0–20.9 versions.
---
Nitpick comments:
In `@node-ical.d.ts`:
- Around line 112-125: Improve the declarations for objectHandlers,
handleObject, and parseLines in the default export object: either replace
unknown with accurate callable/record types for these internal properties, or
add a brief comment documenting that unknown is intentional to discourage direct
consumer use. Preserve the existing exported API shape and type the properties
consistently.
In `@test/module-formats.test.js`:
- Around line 49-76: Consolidate the duplicated ESM/CJS key-parity loop
currently present in both tests. Either merge the assertions into one test or
extract a shared helper and reuse it from the tests, while preserving the
existing missing-key assertion message and API checks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6b141778-ebaf-4a2d-b1e9-418028e5ec77
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (42)
.github/workflows/nodejs.yml.gitignoreREADME.mdbuild/README.mdbuild/build-cjs.jsbuild/update-windows-zones.jsexamples/example-rrule-basic.jsexamples/example-rrule-datefns.jsexamples/example-rrule-dayjs.jsexamples/example-rrule-luxon.jsexamples/example-rrule-moment.jsexamples/example-rrule-vanilla.jsexamples/example.jsical.jslib/core-api.jslib/date-utils.jslib/expand-recurring-event.jslib/ical-parser-utils.jslib/public-api.jslib/temporal.jslib/tz-utils.jsnode-ical.d.tsnode-ical.jspackage.jsontest/advanced.test.jstest/async-error-handling.test.jstest/basic.test.jstest/date-only-rrule-until.test.jstest/examples-snapshot.test.jstest/expand-recurring-event.test.jstest/extended-components.test.jstest/from-url.test.jstest/google-calendar-until-bug.test.jstest/issue-459-exchange-recurrence-id.test.jstest/meta-preservation.test.jstest/module-formats.test.jstest/monthly-bymonthday-multiple.test.jstest/non-utc-until.test.jstest/polyfill-check.test.jstest/tsconfig.jsontest/tz-utils.test.jstsconfig.json
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 8
🧹 Nitpick comments (2)
test/module-formats.test.js (1)
49-76: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDuplicated key-parity check across two tests.
The key-parity loop at Lines 61–63 (
for (const key of Object.keys(esm.default)) { assert.ok(Object.hasOwn(cjs, key), ...) }) is repeated verbatim at Lines 73–75 in the next test. Consider consolidating into a shared helper or merging the assertions into a single test to avoid drift.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/module-formats.test.js` around lines 49 - 76, Consolidate the duplicated ESM/CJS key-parity loop currently present in both tests. Either merge the assertions into one test or extract a shared helper and reuse it from the tests, while preserving the existing missing-key assertion message and API checks.node-ical.d.ts (1)
112-125: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider more precise types for internal properties currently typed
unknown.
objectHandlers,handleObject, andparseLinesare typed asunknown, which gives consumers no type safety if they access these properties. If this is intentional to discourage direct use, consider adding a brief comment explaining that. Otherwise, typing them (e.g., asRecord<string, (...args: unknown[]) => unknown>and(...args: unknown[]) => unknown) would improve the developer experience for advanced consumers.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@node-ical.d.ts` around lines 112 - 125, Improve the declarations for objectHandlers, handleObject, and parseLines in the default export object: either replace unknown with accurate callable/record types for these internal properties, or add a brief comment documenting that unknown is intentional to discourage direct consumer use. Preserve the existing exported API shape and type the properties consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@build/update-windows-zones.js`:
- Around line 18-45: Update fetchText to enforce a request timeout so stalled
CLDR requests reject instead of hanging CI. Prefer replacing the manual
https.get redirect flow with Node 20’s fetch and AbortSignal.timeout(), while
preserving non-success HTTP errors and returning the response text for
successful requests.
In `@ical.js`:
- Around line 463-475: Update the named exports for handleObject, parseLines,
and parseICS in ical.js to bind each function to the ical object so calls retain
the required this context; apply the same binding treatment to the equivalent
exports in node-ical.js, while leaving objectHandlers unchanged.
In `@lib/expand-recurring-event.js`:
- Around line 94-120: Update getEventDurationMs and calculateEndTime to
represent full-day durations as calendar-day counts rather than fixed
milliseconds. For full-day events, compute the span between local calendar dates
and advance the start using local date arithmetic so DST transitions preserve
the correct end date; keep timed-event millisecond duration behavior unchanged.
- Around line 345-358: Update the recurring-instance expansion around
buildRecurringInstance so it also inspects event.recurrences overrides whose
effective start falls within the requested range, even when their RECURRENCE-ID
is outside searchFrom..searchTo. Merge these override-derived instances with the
RRULE results, deduplicate instances already produced through RRULE expansion,
then retain the existing range filtering and start-time sorting.
In `@lib/ical-parser-utils.js`:
- Around line 41-46: Update copyRecordFields to iterate and copy only source own
properties using Object.hasOwn, and avoid assignment-based writes for the
__proto__ UID by defining UID-keyed properties with Object.defineProperty or
using null-prototype records throughout the related merge/recurrence path. Apply
the same protection to the code around the UID handling at the referenced later
section, preserving normal field-copy behavior for other keys.
- Around line 721-733: Update freebusyParameter so it invokes the FREEBUSY
storage handler returned or registered by storeParameter, rather than merely
calling storeParameter and discarding its result. Ensure the raw value and
parameters are persisted on fb before dateParameter processes the start and end
parts.
- Around line 185-194: Update applyImplicitEndDate for DATE entries to advance
entry.start by one calendar day while preserving local midnight, rather than
using utcAdd(..., 1, 'days'). Keep the existing date-time cloning behavior and
return flow unchanged.
In `@package.json`:
- Around line 4-24: Update the package.json engines.node constraint to require
Node.js >=20.10.0, ensuring the ESM entry using JSON import attributes is not
exposed to unsupported Node 20.0–20.9 versions.
---
Nitpick comments:
In `@node-ical.d.ts`:
- Around line 112-125: Improve the declarations for objectHandlers,
handleObject, and parseLines in the default export object: either replace
unknown with accurate callable/record types for these internal properties, or
add a brief comment documenting that unknown is intentional to discourage direct
consumer use. Preserve the existing exported API shape and type the properties
consistently.
In `@test/module-formats.test.js`:
- Around line 49-76: Consolidate the duplicated ESM/CJS key-parity loop
currently present in both tests. Either merge the assertions into one test or
extract a shared helper and reuse it from the tests, while preserving the
existing missing-key assertion message and API checks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6b141778-ebaf-4a2d-b1e9-418028e5ec77
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (42)
.github/workflows/nodejs.yml.gitignoreREADME.mdbuild/README.mdbuild/build-cjs.jsbuild/update-windows-zones.jsexamples/example-rrule-basic.jsexamples/example-rrule-datefns.jsexamples/example-rrule-dayjs.jsexamples/example-rrule-luxon.jsexamples/example-rrule-moment.jsexamples/example-rrule-vanilla.jsexamples/example.jsical.jslib/core-api.jslib/date-utils.jslib/expand-recurring-event.jslib/ical-parser-utils.jslib/public-api.jslib/temporal.jslib/tz-utils.jsnode-ical.d.tsnode-ical.jspackage.jsontest/advanced.test.jstest/async-error-handling.test.jstest/basic.test.jstest/date-only-rrule-until.test.jstest/examples-snapshot.test.jstest/expand-recurring-event.test.jstest/extended-components.test.jstest/from-url.test.jstest/google-calendar-until-bug.test.jstest/issue-459-exchange-recurrence-id.test.jstest/meta-preservation.test.jstest/module-formats.test.jstest/monthly-bymonthday-multiple.test.jstest/non-utc-until.test.jstest/polyfill-check.test.jstest/tsconfig.jsontest/tz-utils.test.jstsconfig.json
🛑 Comments failed to post (8)
build/update-windows-zones.js (1)
18-45: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash # Verify AbortSignal.timeout() and fetch() availability in Node 20+ node -e " const hasFetch = typeof fetch === 'function'; const hasAbortTimeout = typeof AbortSignal.timeout === 'function'; console.log('fetch:', hasFetch); console.log('AbortSignal.timeout:', hasAbortTimeout); if (!hasFetch || !hasAbortTimeout) process.exit(1); "Repository: jens-maus/node-ical
Length of output: 195
🏁 Script executed:
#!/bin/bash set -euo pipefail # Inspect the file structure and relevant symbols ast-grep outline build/update-windows-zones.js --view expanded || true # Read the file with line numbers wc -l build/update-windows-zones.js cat -n build/update-windows-zones.js | sed -n '1,220p' # Check whether https is used elsewhere in the file rg -n "\bhttps\b|fetchText|AbortSignal\.timeout|globalThis\.fetch|fetch\(" build/update-windows-zones.jsRepository: jens-maus/node-ical
Length of output: 7600
Add a timeout to
fetchTextto avoid CI hangs.
https.get()here can wait indefinitely if the CLDR endpoint stalls. Since this script runs on Node 20+, switching tofetch()withAbortSignal.timeout()would also remove the manual redirect handling.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@build/update-windows-zones.js` around lines 18 - 45, Update fetchText to enforce a request timeout so stalled CLDR requests reject instead of hanging CI. Prefer replacing the manual https.get redirect flow with Node 20’s fetch and AbortSignal.timeout(), while preserving non-success HTTP errors and returning the response text for successful requests.ical.js (1)
463-475: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Bind named exports that depend on
this.Directly importing
handleObject,parseLines, orparseICScalls them withthis === undefined; each accesses another method or property throughthisand will fail. Bind these exports toical. The equivalent exports innode-ical.jsneed the same treatment.Proposed fix
const { objectHandlers, - handleObject, - parseLines, - parseICS, } = ical; +const handleObject = ical.handleObject.bind(ical); +const parseLines = ical.parseLines.bind(ical); +const parseICS = ical.parseICS.bind(ical);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.const { objectHandlers, } = ical; const handleObject = ical.handleObject.bind(ical); const parseLines = ical.parseLines.bind(ical); const parseICS = ical.parseICS.bind(ical); export { objectHandlers, handleObject, parseLines, parseICS, };🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ical.js` around lines 463 - 475, Update the named exports for handleObject, parseLines, and parseICS in ical.js to bind each function to the ical object so calls retain the required this context; apply the same binding treatment to the equivalent exports in node-ical.js, while leaving objectHandlers unchanged.lib/expand-recurring-event.js (2)
94-120: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Use calendar-day spans for full-day event ends.
Adding a fixed millisecond duration to local midnight produces 23:00 or 01:00 ends around DST transitions. Track full-day duration as a number of calendar dates and advance with local calendar arithmetic.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/expand-recurring-event.js` around lines 94 - 120, Update getEventDurationMs and calculateEndTime to represent full-day durations as calendar-day counts rather than fixed milliseconds. For full-day events, compute the span between local calendar dates and advance the start using local date arithmetic so DST transitions preserve the correct end date; keep timed-event millisecond duration behavior unchanged.
345-358: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Include overrides moved into the requested range.
Only RRULE dates inside
searchFrom..searchToare inspected. An override keyed by an earlierRECURRENCE-IDbut moved into this range is therefore omitted. Merge uniqueevent.recurrenceswhose effective starts overlap the range, while deduplicating overrides already reached through RRULE expansion.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/expand-recurring-event.js` around lines 345 - 358, Update the recurring-instance expansion around buildRecurringInstance so it also inspects event.recurrences overrides whose effective start falls within the requested range, even when their RECURRENCE-ID is outside searchFrom..searchTo. Merge these override-derived instances with the RRULE results, deduplicate instances already produced through RRULE expansion, then retain the existing range filtering and start-time sorting.lib/ical-parser-utils.js (3)
41-46: 🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win
Store UID keys without invoking object prototype setters.
A UID of
__proto__resolves toObject.prototype; the merge or recurrence path then writes parsed event fields onto the global prototype. UseObject.hasOwn, copy only own fields, and define UID properties withObject.definePropertyor use null-prototype records.Proposed approach
+function setRecordField(target, key, value) { + Object.defineProperty(target, key, { + value, + enumerable: true, + configurable: true, + writable: true, + }); +} + function copyRecordFields(target, source) { - for (const key in source) { - if (key !== null) { - target[key] = source[key]; - } + for (const key of Object.keys(source)) { + setRecordField(target, key, source[key]); } } ... - if (parentEntry[uid] === undefined) { - parentEntry[uid] = sourceEntry; + if (!Object.hasOwn(parentEntry, uid)) { + setRecordField(parentEntry, uid, sourceEntry);Also applies to: 99-120
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/ical-parser-utils.js` around lines 41 - 46, Update copyRecordFields to iterate and copy only source own properties using Object.hasOwn, and avoid assignment-based writes for the __proto__ UID by defining UID-keyed properties with Object.defineProperty or using null-prototype records throughout the related merge/recurrence path. Apply the same protection to the code around the UID handling at the referenced later section, preserving normal field-copy behavior for other keys.
185-194: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Advance DATE values by a calendar day, not 24 elapsed hours.
utcAdd(..., 1, 'days')adds exactly 24 hours. Across DST transitions, the implicit end can become 23:00 or 01:00 instead of local midnight on the next date.Proposed fix
if (entry.duration === undefined) { - entry.end = entry.datetype === 'date-time' - ? cloneDateWithMeta(entry.start) - : cloneDateWithMeta(entry.start, utcAdd(entry.start, 1, 'days')); + entry.end = cloneDateWithMeta(entry.start); + if (entry.datetype !== 'date-time') { + entry.end.setDate(entry.end.getDate() + 1); + } return entry; }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.function applyImplicitEndDate(entry, utcAdd) { if (entry.end) { return entry; } if (entry.duration === undefined) { entry.end = cloneDateWithMeta(entry.start); if (entry.datetype !== 'date-time') { entry.end.setDate(entry.end.getDate() + 1); } return entry;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/ical-parser-utils.js` around lines 185 - 194, Update applyImplicitEndDate for DATE entries to advance entry.start by one calendar day while preserving local midnight, rather than using utcAdd(..., 1, 'days'). Keep the existing date-time cloning behavior and return flow unchanged.
721-733: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Invoke the FREEBUSY storage handler.
storeParameter(value, parameters, fb)only creates and discards a handler, so the raw FREEBUSY value and its parameters are never stored.Proposed fix
- storeParameter(value, parameters, fb); + storeParameter(name)(value, parameters, fb);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.const freebusyParameter = function (name) { return function (value, parameters, curr) { const fb = addFBType({}, parameters); curr[name] ||= []; curr[name].push(fb); storeParameter(name)(value, parameters, fb); const parts = value.split('/'); for (const [index, partName] of ['start', 'end'].entries()) { dateParameter(partName)(parts[index], parameters, fb); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/ical-parser-utils.js` around lines 721 - 733, Update freebusyParameter so it invokes the FREEBUSY storage handler returned or registered by storeParameter, rather than merely calling storeParameter and discarding its result. Ensure the raw value and parameters are persisted on fb before dateParameter processes the start and end parts.package.json (1)
4-24: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash # Check the engines.node field and verify compatibility with import attributes cat package.json | jq '.engines'Repository: jens-maus/node-ical
Length of output: 178
🏁 Script executed:
#!/bin/bash set -euo pipefail printf '\n## package.json engines and module fields\n' cat -n package.json | sed -n '1,80p' printf '\n## referenced source snippets\n' for f in lib/tz-utils.js lib/temporal.js; do echo "\n### $f" cat -n "$f" | sed -n '1,220p' done printf '\n## shipped entry files\n' git ls-files 'node-ical.*' 'lib/*.js' 'windowsZones.json'Repository: jens-maus/node-ical
Length of output: 11636
Bump
engines.nodeto>=20.10.0.lib/tz-utils.jsuses JSON import attributes, so>=20still admits Node 20.0–20.9, which will fail to load the ESM entry.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@package.json` around lines 4 - 24, Update the package.json engines.node constraint to require Node.js >=20.10.0, ensuring the ESM entry using JSON import attributes is not exposed to unsupported Node 20.0–20.9 versions.Source: Learnings
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@jens-maus coderabbit seems satisfied. What do you think? |
|
@KristjanESPERANTO Thanks. this LGTM and is close to getting merged ;-) The only potential improvement would be, if you could add an additional test which ensures that CommonJS support (as long as it exists in node-ical) is still working. Thus, having a simple test that loads and processes something using CommonJS. Is that something that makes sense and feasible? |
|
Yes, makes sense. I just added one :) |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
test/examples-snapshot.test.js (1)
54-54: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winRemove unnecessary
vflag from regular expression.The
v(Unicode sets) flag is not required for this simple extension-matching regular expression. Additionally, since thevflag was introduced in Node.js 20, using it may cause aSyntaxErrorif this test is executed in older Node.js environments that might still be supported.Consider removing the
vflag for improved compatibility and simplicity.♻️ Proposed fix
- const snapshotFile = path.join(snapshotDir, script.replace(/\.(?:c|m)?js$/v, '.txt')); + const snapshotFile = path.join(snapshotDir, script.replace(/\.(?:c|m)?js$/, '.txt'));🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/examples-snapshot.test.js` at line 54, Update the regular expression in the snapshotFile path construction to remove the unnecessary v flag, while preserving its existing extension-matching behavior and compatibility with older Node.js versions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/ical-parser-utils.js`:
- Around line 754-758: Update the FREEBUSY period parsing around the `parts`
loop to distinguish start/end values from start/duration values. When the second
token is an RFC 5545 duration, parse it as a duration and derive `fb.end` from
the parsed start date; retain the existing `dateParameter` handling for explicit
end dates. Add coverage for both period representations.
- Around line 258-260: Update finalizeEndedComponent so applyImplicitEndDate is
skipped for VALARM components, identified via the component’s name/type, while
retaining the existing end-date derivation for other components. Ensure
repeating alarms with DURATION and no start do not pass undefined into utcAdd or
receive an end value.
In `@test/commonjs-compat.test.js`:
- Around line 27-29: Remove the blank line immediately after the opening brace
of the test callback in “loads the package through require() and parses a
VEVENT”, leaving the block unpadded while preserving the test logic.
- Around line 3-5: Remove the blank line between the ES import declarations and
the createRequire assignment in commonjs-compat.test.js, keeping the imports and
require setup contiguous to satisfy the import-x/order formatting rule.
---
Nitpick comments:
In `@test/examples-snapshot.test.js`:
- Line 54: Update the regular expression in the snapshotFile path construction
to remove the unnecessary v flag, while preserving its existing
extension-matching behavior and compatibility with older Node.js versions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d086ddac-696a-4735-8485-a777e729259b
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (44)
.github/workflows/nodejs.yml.gitignoreREADME.mdbuild/README.mdbuild/build-cjs.jsbuild/update-windows-zones.jsexamples/example-rrule-basic.jsexamples/example-rrule-datefns.jsexamples/example-rrule-dayjs.jsexamples/example-rrule-luxon.jsexamples/example-rrule-moment.jsexamples/example-rrule-vanilla.jsexamples/example.jsical.jslib/core-api.jslib/date-utils.jslib/expand-recurring-event.jslib/ical-parser-utils.jslib/public-api.jslib/temporal.jslib/tz-utils.jsnode-ical.d.tsnode-ical.jspackage.jsontest/advanced.test.jstest/async-error-handling.test.jstest/basic.test.jstest/commonjs-compat.test.jstest/date-only-rrule-until.test.jstest/examples-snapshot.test.jstest/expand-recurring-event.test.jstest/extended-components.test.jstest/from-url.test.jstest/google-calendar-until-bug.test.jstest/issue-459-exchange-recurrence-id.test.jstest/meta-preservation.test.jstest/module-formats.test.jstest/monthly-bymonthday-multiple.test.jstest/non-utc-until.test.jstest/polyfill-check.test.jstest/regression-fixes.test.jstest/tsconfig.jsontest/tz-utils.test.jstsconfig.json
🚧 Files skipped from review as they are similar to previous changes (36)
- examples/example.js
- test/date-only-rrule-until.test.js
- lib/temporal.js
- test/from-url.test.js
- test/non-utc-until.test.js
- test/tz-utils.test.js
- test/issue-459-exchange-recurrence-id.test.js
- test/google-calendar-until-bug.test.js
- test/meta-preservation.test.js
- .gitignore
- build/README.md
- examples/example-rrule-luxon.js
- examples/example-rrule-moment.js
- test/extended-components.test.js
- test/tsconfig.json
- lib/public-api.js
- examples/example-rrule-basic.js
- .github/workflows/nodejs.yml
- tsconfig.json
- examples/example-rrule-vanilla.js
- build/build-cjs.js
- lib/core-api.js
- examples/example-rrule-datefns.js
- README.md
- test/monthly-bymonthday-multiple.test.js
- lib/date-utils.js
- lib/tz-utils.js
- test/basic.test.js
- package.json
- test/regression-fixes.test.js
- node-ical.d.ts
- node-ical.js
- test/module-formats.test.js
- build/update-windows-zones.js
- ical.js
- lib/expand-recurring-event.js
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/ical-parser-utils.js`:
- Around line 11-18: Update parseParameters() to normalize parameter names to
uppercase at the parsing boundary, and make raw enumerated-value checks
case-insensitive throughout parseValue and the referenced parameter-handling
paths. Ensure mixed-case TZID, VALUE=DATE, FBTYPE, and TRUE/FALSE inputs follow
the same behavior as uppercase forms, with tests covering each case.
- Around line 744-760: Update the returned parser from freebusyParameter to
split value on commas and process each period independently, creating and
appending a distinct fb object for every period. For each period, split on "/"
and pass its start and end components to dateParameter, preserving parameter
storage and support for both single and multiple FREEBUSY periods.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e3849379-bdb0-4544-b76c-84716773f6b7
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (44)
.github/workflows/nodejs.yml.gitignoreREADME.mdbuild/README.mdbuild/build-cjs.jsbuild/update-windows-zones.jsexamples/example-rrule-basic.jsexamples/example-rrule-datefns.jsexamples/example-rrule-dayjs.jsexamples/example-rrule-luxon.jsexamples/example-rrule-moment.jsexamples/example-rrule-vanilla.jsexamples/example.jsical.jslib/core-api.jslib/date-utils.jslib/expand-recurring-event.jslib/ical-parser-utils.jslib/public-api.jslib/temporal.jslib/tz-utils.jsnode-ical.d.tsnode-ical.jspackage.jsontest/advanced.test.jstest/async-error-handling.test.jstest/basic.test.jstest/commonjs-compat.test.jstest/date-only-rrule-until.test.jstest/examples-snapshot.test.jstest/expand-recurring-event.test.jstest/extended-components.test.jstest/from-url.test.jstest/google-calendar-until-bug.test.jstest/issue-459-exchange-recurrence-id.test.jstest/meta-preservation.test.jstest/module-formats.test.jstest/monthly-bymonthday-multiple.test.jstest/non-utc-until.test.jstest/polyfill-check.test.jstest/regression-fixes.test.jstest/tsconfig.jsontest/tz-utils.test.jstsconfig.json
🚧 Files skipped from review as they are similar to previous changes (34)
- test/meta-preservation.test.js
- test/commonjs-compat.test.js
- lib/public-api.js
- lib/temporal.js
- test/tsconfig.json
- build/README.md
- test/non-utc-until.test.js
- test/tz-utils.test.js
- tsconfig.json
- build/build-cjs.js
- examples/example-rrule-moment.js
- test/date-only-rrule-until.test.js
- test/issue-459-exchange-recurrence-id.test.js
- .gitignore
- test/regression-fixes.test.js
- test/expand-recurring-event.test.js
- .github/workflows/nodejs.yml
- README.md
- test/google-calendar-until-bug.test.js
- lib/date-utils.js
- node-ical.d.ts
- lib/core-api.js
- examples/example-rrule-luxon.js
- lib/tz-utils.js
- test/extended-components.test.js
- node-ical.js
- test/advanced.test.js
- package.json
- test/module-formats.test.js
- build/update-windows-zones.js
- test/async-error-handling.test.js
- test/from-url.test.js
- ical.js
- lib/expand-recurring-event.js
|
Most of the nitpicks are valid, even if they are a bit out of scope. I'm currently working on addressing them. |
3d54949 to
e921362
Compare
|
@coderabbitai resume |
✅ Action performedReviews resumed. |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/ical-parser-utils.js`:
- Around line 277-279: Restrict the applyImplicitEndDate call to supported
components that define a start value, excluding VTIMEZONE and other components
without start/end semantics. Update the condition around applyImplicitEndDate
while preserving the existing utcAdd behavior for valid start-bearing
components.
- Around line 481-483: Update the parameter handling around the `data`
construction and the related URI-repair logic to compare parameter names and
values case-insensitively. Ensure variants such as `value=text`,
`charset=UTF-8`, and `tzid=tzone` follow the same branches as their canonical
forms while preserving the original parameter values in parsed output.
- Around line 750-757: Update the categoriesParameter parser to split CATEGORIES
values only on unescaped commas, preserving escaped commas within a category,
and map each resulting category through text() so escape sequences are decoded.
Apply the same behavior when initializing curr[name] and when appending
additional values.
In `@test/regression-fixes.test.js`:
- Around line 44-73: Update the assertions in the full-day recurring duration
test to use UTC getters, or explicitly pin the test timezone, so results are
independent of the host environment. Keep the expected April 2 start and April 3
midnight end behavior unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: dbb99d0a-e8a5-4f0d-8f08-5f1aa8a14c5f
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (44)
.github/workflows/nodejs.yml.gitignoreREADME.mdbuild/README.mdbuild/build-cjs.jsbuild/update-windows-zones.jsexamples/example-rrule-basic.jsexamples/example-rrule-datefns.jsexamples/example-rrule-dayjs.jsexamples/example-rrule-luxon.jsexamples/example-rrule-moment.jsexamples/example-rrule-vanilla.jsexamples/example.jsical.jslib/core-api.jslib/date-utils.jslib/expand-recurring-event.jslib/ical-parser-utils.jslib/public-api.jslib/temporal.jslib/tz-utils.jsnode-ical.d.tsnode-ical.jspackage.jsontest/advanced.test.jstest/async-error-handling.test.jstest/basic.test.jstest/commonjs-compat.test.jstest/date-only-rrule-until.test.jstest/examples-snapshot.test.jstest/expand-recurring-event.test.jstest/extended-components.test.jstest/from-url.test.jstest/google-calendar-until-bug.test.jstest/issue-459-exchange-recurrence-id.test.jstest/meta-preservation.test.jstest/module-formats.test.jstest/monthly-bymonthday-multiple.test.jstest/non-utc-until.test.jstest/polyfill-check.test.jstest/regression-fixes.test.jstest/tsconfig.jsontest/tz-utils.test.jstsconfig.json
🚧 Files skipped from review as they are similar to previous changes (38)
- lib/temporal.js
- build/build-cjs.js
- lib/public-api.js
- test/tz-utils.test.js
- test/date-only-rrule-until.test.js
- test/meta-preservation.test.js
- examples/example-rrule-basic.js
- test/google-calendar-until-bug.test.js
- .gitignore
- examples/example-rrule-dayjs.js
- examples/example-rrule-luxon.js
- test/extended-components.test.js
- .github/workflows/nodejs.yml
- test/tsconfig.json
- examples/example.js
- tsconfig.json
- examples/example-rrule-vanilla.js
- test/from-url.test.js
- test/commonjs-compat.test.js
- build/README.md
- test/basic.test.js
- lib/date-utils.js
- test/non-utc-until.test.js
- test/issue-459-exchange-recurrence-id.test.js
- test/monthly-bymonthday-multiple.test.js
- examples/example-rrule-datefns.js
- node-ical.d.ts
- README.md
- node-ical.js
- test/module-formats.test.js
- test/expand-recurring-event.test.js
- lib/tz-utils.js
- test/async-error-handling.test.js
- build/update-windows-zones.js
- examples/example-rrule-moment.js
- package.json
- ical.js
- lib/expand-recurring-event.js
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
node-ical.d.ts (1)
112-128: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueExplicitly use
declarefor ambientconstdeclarations.If this block is at the top level of the
.d.tsmodule, omittingdeclareor an initializer could cause a TypeScriptTS1155compilation error for consumers. Even if it is nested within an ambient namespace or module wheredeclareis implicit, adding it explicitly improves readability and aligns with standard type definition practices.✨ Proposed refactor
- const _default: { + declare const _default: { fromURL: typeof fromURL; parseFile: typeof parseFile; parseICS: typeof parseICS; sync: typeof sync; async: typeof async; expandRecurringEvent: typeof expandRecurringEvent; /** Internal compatibility hooks; intentionally left loose to avoid encouraging direct use. */ objectHandlers: unknown; /** Internal compatibility hooks; intentionally left loose to avoid encouraging direct use. */ handleObject: unknown; /** Internal compatibility hooks; intentionally left loose to avoid encouraging direct use. */ parseLines: unknown; }; export default _default;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@node-ical.d.ts` around lines 112 - 128, Update the top-level ambient constant declaration for _default to explicitly use declare, while preserving its existing property types and default export.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/ical-parser-utils.js`:
- Around line 118-139: Update applyUidSequenceMerge and the accepted-revision
merge path to clear prior parsed event fields before copyRecordFields, so
removed properties such as RRULE do not persist; preserve object identity and
parser-owned state including recurrences and inherited method. Retain the
existing recurrence/base-series handling and SEQUENCE precedence, and add
coverage for a higher-SEQUENCE revision removing an optional property.
---
Nitpick comments:
In `@node-ical.d.ts`:
- Around line 112-128: Update the top-level ambient constant declaration for
_default to explicitly use declare, while preserving its existing property types
and default export.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 333aa127-d546-435f-93df-0ad36387d74c
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (44)
.github/workflows/nodejs.yml.gitignoreREADME.mdbuild/README.mdbuild/build-cjs.jsbuild/update-windows-zones.jsexamples/example-rrule-basic.jsexamples/example-rrule-datefns.jsexamples/example-rrule-dayjs.jsexamples/example-rrule-luxon.jsexamples/example-rrule-moment.jsexamples/example-rrule-vanilla.jsexamples/example.jsical.jslib/core-api.jslib/date-utils.jslib/expand-recurring-event.jslib/ical-parser-utils.jslib/public-api.jslib/temporal.jslib/tz-utils.jsnode-ical.d.tsnode-ical.jspackage.jsontest/advanced.test.jstest/async-error-handling.test.jstest/basic.test.jstest/commonjs-compat.test.jstest/date-only-rrule-until.test.jstest/examples-snapshot.test.jstest/expand-recurring-event.test.jstest/extended-components.test.jstest/from-url.test.jstest/google-calendar-until-bug.test.jstest/issue-459-exchange-recurrence-id.test.jstest/meta-preservation.test.jstest/module-formats.test.jstest/monthly-bymonthday-multiple.test.jstest/non-utc-until.test.jstest/polyfill-check.test.jstest/regression-fixes.test.jstest/tsconfig.jsontest/tz-utils.test.jstsconfig.json
🚧 Files skipped from review as they are similar to previous changes (32)
- test/meta-preservation.test.js
- lib/temporal.js
- test/commonjs-compat.test.js
- .github/workflows/nodejs.yml
- test/google-calendar-until-bug.test.js
- examples/example-rrule-vanilla.js
- test/tsconfig.json
- examples/example-rrule-datefns.js
- examples/example-rrule-basic.js
- test/date-only-rrule-until.test.js
- build/build-cjs.js
- test/extended-components.test.js
- lib/public-api.js
- test/tz-utils.test.js
- test/advanced.test.js
- lib/core-api.js
- build/README.md
- test/issue-459-exchange-recurrence-id.test.js
- examples/example-rrule-moment.js
- lib/date-utils.js
- test/module-formats.test.js
- build/update-windows-zones.js
- test/non-utc-until.test.js
- test/regression-fixes.test.js
- tsconfig.json
- examples/example-rrule-luxon.js
- node-ical.js
- README.md
- package.json
- test/async-error-handling.test.js
- ical.js
- lib/expand-recurring-event.js
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
lib/ical-parser-utils.js (1)
133-141: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winFully replace override-first entries when the base series arrives.
This branch still overlays base fields onto the override, leaving override-only properties on the resulting base event. Clear removed fields before copying;
recurrencesandmethodare already preserved.Proposed fix
if (existingIsRecurrence && incomingIsBaseSeries) { + clearFieldsRemovedInRevision(existingEntry, incomingEntry); copyRecordFields(existingEntry, incomingEntry); return; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/ical-parser-utils.js` around lines 133 - 141, Update applyUidSequenceMerge’s existingIsRecurrence/incomingIsBaseSeries branch to clear the existing override record’s removed fields before copying base-series fields, while preserving recurrences and method as currently handled. Ensure the resulting entry is fully replaced by the incoming base series rather than retaining override-only properties.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/ical-parser-utils.js`:
- Around line 342-347: Update the supportsImplicitEnd condition in the implicit
end derivation flow to allow only VEVENT and VTODO components with a Date-valued
start; remove VJOURNAL so applyImplicitEndDate is never called for journal
entries.
- Around line 284-297: Update applyDurationToDate and the related FREEBUSY
duration parsing path to accept an optional leading + sign and match duration
designators case-insensitively. Normalize matched unit letters before
DURATION_UNITS lookup, while preserving existing negative-duration handling and
date parsing for non-duration values.
---
Duplicate comments:
In `@lib/ical-parser-utils.js`:
- Around line 133-141: Update applyUidSequenceMerge’s
existingIsRecurrence/incomingIsBaseSeries branch to clear the existing override
record’s removed fields before copying base-series fields, while preserving
recurrences and method as currently handled. Ensure the resulting entry is fully
replaced by the incoming base series rather than retaining override-only
properties.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f7d7f539-3bda-4be8-8cf9-d5d4134cdb70
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (44)
.github/workflows/nodejs.yml.gitignoreREADME.mdbuild/README.mdbuild/build-cjs.jsbuild/update-windows-zones.jsexamples/example-rrule-basic.jsexamples/example-rrule-datefns.jsexamples/example-rrule-dayjs.jsexamples/example-rrule-luxon.jsexamples/example-rrule-moment.jsexamples/example-rrule-vanilla.jsexamples/example.jsical.jslib/core-api.jslib/date-utils.jslib/expand-recurring-event.jslib/ical-parser-utils.jslib/public-api.jslib/temporal.jslib/tz-utils.jsnode-ical.d.tsnode-ical.jspackage.jsontest/advanced.test.jstest/async-error-handling.test.jstest/basic.test.jstest/commonjs-compat.test.jstest/date-only-rrule-until.test.jstest/examples-snapshot.test.jstest/expand-recurring-event.test.jstest/extended-components.test.jstest/from-url.test.jstest/google-calendar-until-bug.test.jstest/issue-459-exchange-recurrence-id.test.jstest/meta-preservation.test.jstest/module-formats.test.jstest/monthly-bymonthday-multiple.test.jstest/non-utc-until.test.jstest/polyfill-check.test.jstest/regression-fixes.test.jstest/tsconfig.jsontest/tz-utils.test.jstsconfig.json
🚧 Files skipped from review as they are similar to previous changes (33)
- lib/temporal.js
- test/commonjs-compat.test.js
- test/google-calendar-until-bug.test.js
- test/monthly-bymonthday-multiple.test.js
- test/expand-recurring-event.test.js
- test/issue-459-exchange-recurrence-id.test.js
- examples/example-rrule-moment.js
- examples/example-rrule-dayjs.js
- test/date-only-rrule-until.test.js
- test/meta-preservation.test.js
- lib/public-api.js
- test/tz-utils.test.js
- examples/example-rrule-basic.js
- test/non-utc-until.test.js
- tsconfig.json
- build/build-cjs.js
- .gitignore
- test/tsconfig.json
- test/async-error-handling.test.js
- examples/example-rrule-vanilla.js
- examples/example-rrule-datefns.js
- node-ical.d.ts
- lib/core-api.js
- package.json
- test/module-formats.test.js
- test/regression-fixes.test.js
- test/from-url.test.js
- lib/tz-utils.js
- README.md
- node-ical.js
- build/update-windows-zones.js
- ical.js
- lib/expand-recurring-event.js
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/ical-parser-utils.js`:
- Around line 705-745: Update the no-TZID handling around
fallbackWithStackTimezone so floating DATE-TIME values return the local
wall-clock Date directly without consulting stack VTIMEZONE data. Apply this to
both no-TZID branches, including the corresponding logic near the alternate
referenced location, while preserving timezone resolution for values that
explicitly provide a TZID.
In `@test/regression-fixes.test.js`:
- Around line 45-46: Update the full-day recurring duration test in the relevant
it block to capture the existing process.env.TZ value, set the UTC timezone only
for the test, and restore the original value in a finally block, deleting the
variable when it was previously unset.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ae63a25c-acf9-4607-a70d-b223f2083949
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (44)
.github/workflows/nodejs.yml.gitignoreREADME.mdbuild/README.mdbuild/build-cjs.jsbuild/update-windows-zones.jsexamples/example-rrule-basic.jsexamples/example-rrule-datefns.jsexamples/example-rrule-dayjs.jsexamples/example-rrule-luxon.jsexamples/example-rrule-moment.jsexamples/example-rrule-vanilla.jsexamples/example.jsical.jslib/core-api.jslib/date-utils.jslib/expand-recurring-event.jslib/ical-parser-utils.jslib/public-api.jslib/temporal.jslib/tz-utils.jsnode-ical.d.tsnode-ical.jspackage.jsontest/advanced.test.jstest/async-error-handling.test.jstest/basic.test.jstest/commonjs-compat.test.jstest/date-only-rrule-until.test.jstest/examples-snapshot.test.jstest/expand-recurring-event.test.jstest/extended-components.test.jstest/from-url.test.jstest/google-calendar-until-bug.test.jstest/issue-459-exchange-recurrence-id.test.jstest/meta-preservation.test.jstest/module-formats.test.jstest/monthly-bymonthday-multiple.test.jstest/non-utc-until.test.jstest/polyfill-check.test.jstest/regression-fixes.test.jstest/tsconfig.jsontest/tz-utils.test.jstsconfig.json
🚧 Files skipped from review as they are similar to previous changes (32)
- .gitignore
- test/commonjs-compat.test.js
- test/date-only-rrule-until.test.js
- test/google-calendar-until-bug.test.js
- test/meta-preservation.test.js
- test/issue-459-exchange-recurrence-id.test.js
- test/tz-utils.test.js
- test/basic.test.js
- examples/example.js
- test/expand-recurring-event.test.js
- .github/workflows/nodejs.yml
- test/tsconfig.json
- lib/public-api.js
- examples/example-rrule-basic.js
- examples/example-rrule-luxon.js
- test/monthly-bymonthday-multiple.test.js
- test/advanced.test.js
- build/build-cjs.js
- lib/temporal.js
- test/from-url.test.js
- tsconfig.json
- lib/core-api.js
- test/non-utc-until.test.js
- build/README.md
- lib/date-utils.js
- package.json
- node-ical.d.ts
- ical.js
- test/module-formats.test.js
- node-ical.js
- lib/tz-utils.js
- lib/expand-recurring-event.js
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/ical-parser-utils.js`:
- Around line 285-300: The applyDurationToDate function currently extracts
valid-looking fragments from malformed duration strings; replace this
partial-match approach with full RFC-duration validation/parsing before calling
utcAdd, rejecting values with missing required designators, unsupported formats,
or trailing/embedded garbage. Preserve the existing unit application and sign
behavior for fully valid durations, and add regression coverage for partially
valid inputs such as P1M and values with trailing garbage.
- Around line 134-142: Update the base-series detection in the merge branch
around existingIsRecurrence and incomingIsBaseSeries so any incoming entry
without recurrenceid is treated as the base component, including RDATE-only
entries. Remove the unnecessary rrule requirement while preserving the existing
clearFieldsRemovedInRevision, copyRecordFields, and return behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 66638e63-e052-4f4b-a980-6e4430c2206b
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (44)
.github/workflows/nodejs.yml.gitignoreREADME.mdbuild/README.mdbuild/build-cjs.jsbuild/update-windows-zones.jsexamples/example-rrule-basic.jsexamples/example-rrule-datefns.jsexamples/example-rrule-dayjs.jsexamples/example-rrule-luxon.jsexamples/example-rrule-moment.jsexamples/example-rrule-vanilla.jsexamples/example.jsical.jslib/core-api.jslib/date-utils.jslib/expand-recurring-event.jslib/ical-parser-utils.jslib/public-api.jslib/temporal.jslib/tz-utils.jsnode-ical.d.tsnode-ical.jspackage.jsontest/advanced.test.jstest/async-error-handling.test.jstest/basic.test.jstest/commonjs-compat.test.jstest/date-only-rrule-until.test.jstest/examples-snapshot.test.jstest/expand-recurring-event.test.jstest/extended-components.test.jstest/from-url.test.jstest/google-calendar-until-bug.test.jstest/issue-459-exchange-recurrence-id.test.jstest/meta-preservation.test.jstest/module-formats.test.jstest/monthly-bymonthday-multiple.test.jstest/non-utc-until.test.jstest/polyfill-check.test.jstest/regression-fixes.test.jstest/tsconfig.jsontest/tz-utils.test.jstsconfig.json
🚧 Files skipped from review as they are similar to previous changes (41)
- .gitignore
- test/date-only-rrule-until.test.js
- lib/public-api.js
- test/commonjs-compat.test.js
- build/README.md
- test/monthly-bymonthday-multiple.test.js
- test/meta-preservation.test.js
- build/build-cjs.js
- test/from-url.test.js
- test/issue-459-exchange-recurrence-id.test.js
- examples/example-rrule-dayjs.js
- test/tsconfig.json
- test/expand-recurring-event.test.js
- examples/example-rrule-luxon.js
- examples/example-rrule-basic.js
- test/google-calendar-until-bug.test.js
- test/tz-utils.test.js
- examples/example.js
- test/extended-components.test.js
- test/non-utc-until.test.js
- .github/workflows/nodejs.yml
- examples/example-rrule-datefns.js
- lib/temporal.js
- examples/example-rrule-moment.js
- lib/core-api.js
- test/advanced.test.js
- lib/date-utils.js
- lib/tz-utils.js
- test/module-formats.test.js
- tsconfig.json
- test/async-error-handling.test.js
- test/basic.test.js
- node-ical.d.ts
- package.json
- README.md
- node-ical.js
- examples/example-rrule-vanilla.js
- ical.js
- build/update-windows-zones.js
- lib/expand-recurring-event.js
- test/regression-fixes.test.js
|
Thanks @KristjanESPERANTO for addressing all coderabbitai concerns and tremendously working on that nice ESM migration. Will merge it now to get going and hopefully prepare a new 0.27.0 release after testing it throughoutly ASAP. |
|
Yeah, at times it felt like a never-ending story 😅 Most of the comments were actually outside the scope. But they were valid. |
This change follows up on issue #521 and moves node-ical to an ESM-first setup, while keeping CommonJS support in place for now.
It turned out to take a bit more than expected. To make the module split cleanly, I moved a fair amount of logic out of the files ical.js and node-ical.js into smaller, focused modules. That makes the code easier to maintain and gives a cleaner base for the module format transition.
I checked compatibility against our main consumers (ioBroker.ical and MagicMirror), and both still work with this setup.
Summary by CodeRabbit